package com.vmj.instructions.base;

import com.vmj.heap.VMObject;

/**
 * Created by yangshoujun on 2017/9/9 下午1:55.
 */
public class CheckUtils {

    public static void checkNotNull(VMObject ref) {
        if(ref == null) {
            throw new RuntimeException("java.lang.NullPointerException");
        }
    }

    public static void checkIndex(int len, int index) {
        if(index < 0 || index > len) {
            throw new RuntimeException("java.lang.IndexOutofBoundsException");
        }
    }
}
